package com.api;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.component.domain.MLog;
import com.component.service.MLogService;
import com.system.common.Result;
import com.system.security.SecurityUtil;
import com.system.security.domain.SelfUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname MLogApi
 * @Description TODO
 * @Date 2023/9/20 0:24
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@RestController
@RequestMapping("/log")
public class MLogApi {

    @Autowired
    private MLogService mLogService;

    @GetMapping("/page")
    public JSONObject logPage(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                              @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
        SelfUserEntity userEntity= SecurityUtil.getSelfUserEntity();
        IPage<MLog> page=mLogService.page(pageNum,pageSize,userEntity.getUserId().toString());
        return Result.successInfo(page);
    }
}
